package com.openbravo.pos.panels;

import com.openbravo.basic.BasicException;
import com.openbravo.beans.JCalendarDialog;
import com.openbravo.data.gui.ComboBoxValModel;
import com.openbravo.data.gui.ListQBFModelNumber;
import com.openbravo.data.gui.MessageInf;
import com.openbravo.data.loader.QBFCompareEnum;
import com.openbravo.data.loader.SentenceList;
import com.openbravo.data.user.EditorCreator;
import com.openbravo.data.user.ListProvider;
import com.openbravo.data.user.ListProviderCreator;
import com.openbravo.editor.JEditorCurrency;
import com.openbravo.editor.JEditorIntegerPositive;
import com.openbravo.editor.JEditorKeys;
import com.openbravo.format.Formats;
import com.openbravo.pos.customers.CustomerInfo;
import com.openbravo.pos.customers.CustomerInfoExt;
import com.openbravo.pos.customers.DataLogicCustomers;
import com.openbravo.pos.customers.JCustomerFinder;
import com.openbravo.pos.forms.AppLocal;
import com.openbravo.pos.forms.DataLogicSales;
import com.openbravo.pos.inventory.TaxCategoryInfo;
import com.openbravo.pos.ticket.FindTicketsInfo;
import com.openbravo.pos.ticket.FindTicketsRenderer;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout.ParallelGroup;
import javax.swing.GroupLayout.SequentialGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.ListModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

public class JTicketsFinder extends JDialog
  implements EditorCreator
{
  private ListProvider lpr;
  private SentenceList m_sentcat;
  private ComboBoxValModel m_CategoryModel;
  private DataLogicSales dlSales;
  private DataLogicCustomers dlCustomers;
  private FindTicketsInfo selectedTicket;
  private JButton btnCustomer;
  private JButton btnDateEnd;
  private JButton btnDateStart;
  private JButton jButton1;
  private JButton jButton3;
  private JComboBox jComboBoxTicket;
  private JLabel jLabel1;
  private JLabel jLabel3;
  private JLabel jLabel4;
  private JLabel jLabel6;
  private JLabel jLabel7;
  private JList jListTickets;
  private JPanel jPanel1;
  private JPanel jPanel2;
  private JPanel jPanel3;
  private JPanel jPanel4;
  private JPanel jPanel5;
  private JPanel jPanel6;
  private JPanel jPanel7;
  private JPanel jPanel8;
  private JScrollPane jScrollPane1;
  private JTextField jTxtEndDate;
  private JTextField jTxtStartDate;
  private JComboBox jcboMoney;
  private JComboBox jcboUser;
  private JButton jcmdCancel;
  private JButton jcmdOK;
  private JTextField jtxtCustomer;
  private JEditorCurrency jtxtMoney;
  private JEditorIntegerPositive jtxtTicketID;
  private JLabel labelCustomer;
  private JEditorKeys m_jKeys;

  private JTicketsFinder(Frame paramFrame, boolean paramBoolean)
  {
    super(paramFrame, paramBoolean);
  }

  private JTicketsFinder(Dialog paramDialog, boolean paramBoolean)
  {
    super(paramDialog, paramBoolean);
  }

  public static JTicketsFinder getReceiptFinder(Component paramComponent, DataLogicSales paramDataLogicSales, DataLogicCustomers paramDataLogicCustomers)
  {
    Window localWindow = getWindow(paramComponent);
    JTicketsFinder localJTicketsFinder;
    if ((localWindow instanceof Frame))
      localJTicketsFinder = new JTicketsFinder((Frame)localWindow, true);
    else
      localJTicketsFinder = new JTicketsFinder((Dialog)localWindow, true);
    localJTicketsFinder.init(paramDataLogicSales, paramDataLogicCustomers);
    localJTicketsFinder.applyComponentOrientation(paramComponent.getComponentOrientation());
    return localJTicketsFinder;
  }

  public FindTicketsInfo getSelectedCustomer()
  {
    return this.selectedTicket;
  }

  private void init(DataLogicSales paramDataLogicSales, DataLogicCustomers paramDataLogicCustomers)
  {
    this.dlSales = paramDataLogicSales;
    this.dlCustomers = paramDataLogicCustomers;
    initComponents();
    this.jScrollPane1.getVerticalScrollBar().setPreferredSize(new Dimension(35, 35));
    this.jtxtTicketID.addEditorKeys(this.m_jKeys);
    this.jtxtMoney.addEditorKeys(this.m_jKeys);
    this.lpr = new ListProviderCreator(paramDataLogicSales.getTicketsList(), this);
    this.jListTickets.setCellRenderer(new FindTicketsRenderer());
    getRootPane().setDefaultButton(this.jcmdOK);
    initCombos();
    defaultValues();
    this.selectedTicket = null;
  }

  public void executeSearch()
  {
    try
    {
      this.jListTickets.setModel(new MyListData(this.lpr.loadData()));
      if (this.jListTickets.getModel().getSize() > 0)
        this.jListTickets.setSelectedIndex(0);
    }
    catch (BasicException localBasicException)
    {
      localBasicException.printStackTrace();
    }
  }

  private void initCombos()
  {
    String[] arrayOfString = { AppLocal.getIntString("label.sales"), AppLocal.getIntString("label.refunds"), AppLocal.getIntString("label.all") };
    this.jComboBoxTicket.setModel(new DefaultComboBoxModel(arrayOfString));
    this.jcboMoney.setModel(ListQBFModelNumber.getMandatoryNumber());
    this.m_sentcat = this.dlSales.getUserList();
    this.m_CategoryModel = new ComboBoxValModel();
    List localList = null;
    try
    {
      localList = this.m_sentcat.list();
    }
    catch (BasicException localBasicException)
    {
      localBasicException.getMessage();
    }
    localList.add(0, null);
    this.m_CategoryModel = new ComboBoxValModel(localList);
    this.jcboUser.setModel(this.m_CategoryModel);
  }

  private void defaultValues()
  {
    this.jListTickets.setModel(new MyListData(new ArrayList()));
    this.jcboUser.setSelectedItem(null);
    this.jtxtTicketID.reset();
    this.jtxtTicketID.activate();
    this.jComboBoxTicket.setSelectedIndex(0);
    this.jcboUser.setSelectedItem(null);
    this.jcboMoney.setSelectedItem(((ListQBFModelNumber)this.jcboMoney.getModel()).getElementAt(0));
    this.jcboMoney.revalidate();
    this.jcboMoney.repaint();
    this.jtxtMoney.reset();
    this.jTxtStartDate.setText(null);
    this.jTxtEndDate.setText(null);
    this.jtxtCustomer.setText(null);
  }

  public Object createValue()
    throws BasicException
  {
    Object[] arrayOfObject = new Object[14];
    if ((this.jtxtTicketID.getText() == null) || (this.jtxtTicketID.getText().equals("")))
    {
      arrayOfObject[0] = QBFCompareEnum.COMP_NONE;
      arrayOfObject[1] = null;
    }
    else
    {
      arrayOfObject[0] = QBFCompareEnum.COMP_EQUALS;
      arrayOfObject[1] = Integer.valueOf(this.jtxtTicketID.getValueInteger());
    }
    if (this.jComboBoxTicket.getSelectedIndex() == 2)
    {
      arrayOfObject[2] = QBFCompareEnum.COMP_DISTINCT;
      arrayOfObject[3] = Integer.valueOf(2);
    }
    else if (this.jComboBoxTicket.getSelectedIndex() == 0)
    {
      arrayOfObject[2] = QBFCompareEnum.COMP_EQUALS;
      arrayOfObject[3] = Integer.valueOf(0);
    }
    else if (this.jComboBoxTicket.getSelectedIndex() == 1)
    {
      arrayOfObject[2] = QBFCompareEnum.COMP_EQUALS;
      arrayOfObject[3] = Integer.valueOf(1);
    }
    arrayOfObject[5] = this.jtxtMoney.getDoubleValue();
    arrayOfObject[4] = (arrayOfObject[5] == null ? QBFCompareEnum.COMP_NONE : this.jcboMoney.getSelectedItem());
    Object localObject1 = Formats.TIMESTAMP.parseValue(this.jTxtStartDate.getText());
    Object localObject2 = Formats.TIMESTAMP.parseValue(this.jTxtEndDate.getText());
    arrayOfObject[6] = (localObject1 == null ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_GREATEROREQUALS);
    arrayOfObject[7] = localObject1;
    arrayOfObject[8] = (localObject2 == null ? QBFCompareEnum.COMP_NONE : QBFCompareEnum.COMP_LESS);
    arrayOfObject[9] = localObject2;
    if (this.jcboUser.getSelectedItem() == null)
    {
      arrayOfObject[10] = QBFCompareEnum.COMP_NONE;
      arrayOfObject[11] = null;
    }
    else
    {
      arrayOfObject[10] = QBFCompareEnum.COMP_EQUALS;
      arrayOfObject[11] = ((TaxCategoryInfo)this.jcboUser.getSelectedItem()).getName();
    }
    if ((this.jtxtCustomer.getText() == null) || (this.jtxtCustomer.getText().equals("")))
    {
      arrayOfObject[12] = QBFCompareEnum.COMP_NONE;
      arrayOfObject[13] = null;
    }
    else
    {
      arrayOfObject[12] = QBFCompareEnum.COMP_RE;
      arrayOfObject[13] = ("%" + this.jtxtCustomer.getText() + "%");
    }
    return arrayOfObject;
  }

  private static Window getWindow(Component paramComponent)
  {
    if (paramComponent == null)
      return new JFrame();
    if (((paramComponent instanceof Frame)) || ((paramComponent instanceof Dialog)))
      return (Window)paramComponent;
    return getWindow(paramComponent.getParent());
  }

  private void initComponents()
  {
    this.jPanel3 = new JPanel();
    this.jPanel5 = new JPanel();
    this.jPanel7 = new JPanel();
    this.jLabel1 = new JLabel();
    this.jLabel6 = new JLabel();
    this.jLabel7 = new JLabel();
    this.jtxtMoney = new JEditorCurrency();
    this.jcboUser = new JComboBox();
    this.jcboMoney = new JComboBox();
    this.jtxtTicketID = new JEditorIntegerPositive();
    this.labelCustomer = new JLabel();
    this.jLabel3 = new JLabel();
    this.jLabel4 = new JLabel();
    this.jTxtStartDate = new JTextField();
    this.jTxtEndDate = new JTextField();
    this.btnDateStart = new JButton();
    this.btnDateEnd = new JButton();
    this.jtxtCustomer = new JTextField();
    this.btnCustomer = new JButton();
    this.jComboBoxTicket = new JComboBox();
    this.jPanel6 = new JPanel();
    this.jButton1 = new JButton();
    this.jButton3 = new JButton();
    this.jPanel4 = new JPanel();
    this.jScrollPane1 = new JScrollPane();
    this.jListTickets = new JList();
    this.jPanel8 = new JPanel();
    this.jPanel1 = new JPanel();
    this.jcmdOK = new JButton();
    this.jcmdCancel = new JButton();
    this.jPanel2 = new JPanel();
    this.m_jKeys = new JEditorKeys();
    setDefaultCloseOperation(2);
    setTitle(AppLocal.getIntString("form.tickettitle"));
    this.jPanel3.setLayout(new BorderLayout());
    this.jPanel5.setLayout(new BorderLayout());
    this.jPanel7.setPreferredSize(new Dimension(0, 210));
    this.jLabel1.setText(AppLocal.getIntString("label.ticketid"));
    this.jLabel6.setText(AppLocal.getIntString("label.user"));
    this.jLabel7.setText(AppLocal.getIntString("label.totalcash"));
    this.labelCustomer.setText(AppLocal.getIntString("label.customer"));
    this.jLabel3.setText(AppLocal.getIntString("Label.StartDate"));
    this.jLabel4.setText(AppLocal.getIntString("Label.EndDate"));
    this.jTxtStartDate.setPreferredSize(new Dimension(200, 25));
    this.jTxtEndDate.setPreferredSize(new Dimension(200, 25));
    this.btnDateStart.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/date.png")));
    this.btnDateStart.setPreferredSize(new Dimension(50, 25));
    this.btnDateStart.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.btnDateStartActionPerformed(paramActionEvent);
      }
    });
    this.btnDateEnd.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/date.png")));
    this.btnDateEnd.setPreferredSize(new Dimension(50, 25));
    this.btnDateEnd.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.btnDateEndActionPerformed(paramActionEvent);
      }
    });
    this.jtxtCustomer.setPreferredSize(new Dimension(200, 25));
    this.btnCustomer.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/kuser.png")));
    this.btnCustomer.setFocusPainted(false);
    this.btnCustomer.setFocusable(false);
    this.btnCustomer.setMargin(new Insets(8, 14, 8, 14));
    this.btnCustomer.setPreferredSize(new Dimension(50, 25));
    this.btnCustomer.setRequestFocusEnabled(false);
    this.btnCustomer.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.btnCustomerActionPerformed(paramActionEvent);
      }
    });
    GroupLayout localGroupLayout = new GroupLayout(this.jPanel7);
    this.jPanel7.setLayout(localGroupLayout);
    localGroupLayout.setHorizontalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createSequentialGroup().addGap(33, 33, 33).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addComponent(this.jLabel3).addGap(62, 62, 62)).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addComponent(this.jLabel1).addGap(83, 83, 83)).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addComponent(this.jLabel4).addGap(68, 68, 68)).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addComponent(this.labelCustomer).addGap(61, 61, 61))).addComponent(this.jLabel7).addComponent(this.jLabel6)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, -1, 32767).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(this.jcboUser, -2, 255, -2).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.jcboMoney, -2, 100, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.jtxtMoney, -2, 182, -2)).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.jtxtCustomer, -2, -1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.btnCustomer, -2, -1, -2)).addGroup(localGroupLayout.createSequentialGroup().addComponent(this.jTxtEndDate, -2, -1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.btnDateEnd, -2, -1, -2)).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false).addGroup(GroupLayout.Alignment.LEADING, localGroupLayout.createSequentialGroup().addComponent(this.jtxtTicketID, -2, 120, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, -1, 32767).addComponent(this.jComboBoxTicket, -2, 130, -2)).addGroup(GroupLayout.Alignment.LEADING, localGroupLayout.createSequentialGroup().addComponent(this.jTxtStartDate, -2, -1, -2).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(this.btnDateStart, -2, -1, -2)))).addGap(59, 59, 59)));
    localGroupLayout.setVerticalGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, localGroupLayout.createSequentialGroup().addContainerGap(-1, 32767).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.jLabel1).addComponent(this.jtxtTicketID, -2, -1, -2).addComponent(this.jComboBoxTicket, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.jLabel3).addComponent(this.jTxtStartDate, -2, -1, -2).addComponent(this.btnDateStart, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.jLabel4).addComponent(this.jTxtEndDate, -2, -1, -2).addComponent(this.btnDateEnd, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.labelCustomer).addComponent(this.jtxtCustomer, -2, -1, -2).addComponent(this.btnCustomer, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.jLabel6).addComponent(this.jcboUser, -2, -1, -2)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(localGroupLayout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(this.jLabel7).addComponent(this.jcboMoney, -2, -1, -2).addComponent(this.jtxtMoney, -2, -1, -2)).addGap(19, 19, 19)));
    this.jPanel5.add(this.jPanel7, "Center");
    this.jButton1.setText(AppLocal.getIntString("button.clean"));
    this.jButton1.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.jButton1ActionPerformed(paramActionEvent);
      }
    });
    this.jPanel6.add(this.jButton1);
    this.jButton3.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/launch.png")));
    this.jButton3.setText(AppLocal.getIntString("button.executefilter"));
    this.jButton3.setFocusPainted(false);
    this.jButton3.setFocusable(false);
    this.jButton3.setRequestFocusEnabled(false);
    this.jButton3.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.jButton3ActionPerformed(paramActionEvent);
      }
    });
    this.jPanel6.add(this.jButton3);
    this.jPanel5.add(this.jPanel6, "South");
    this.jPanel3.add(this.jPanel5, "First");
    this.jPanel4.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    this.jPanel4.setLayout(new BorderLayout());
    this.jListTickets.setFocusable(false);
    this.jListTickets.setRequestFocusEnabled(false);
    this.jListTickets.addMouseListener(new MouseAdapter()
    {
      public void mouseClicked(MouseEvent paramMouseEvent)
      {
        JTicketsFinder.this.jListTicketsMouseClicked(paramMouseEvent);
      }
    });
    this.jListTickets.addListSelectionListener(new ListSelectionListener()
    {
      public void valueChanged(ListSelectionEvent paramListSelectionEvent)
      {
        JTicketsFinder.this.jListTicketsValueChanged(paramListSelectionEvent);
      }
    });
    this.jScrollPane1.setViewportView(this.jListTickets);
    this.jPanel4.add(this.jScrollPane1, "Center");
    this.jPanel3.add(this.jPanel4, "Center");
    this.jPanel8.setLayout(new BorderLayout());
    this.jcmdOK.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/button_ok.png")));
    this.jcmdOK.setText(AppLocal.getIntString("Button.OK"));
    this.jcmdOK.setEnabled(false);
    this.jcmdOK.setFocusPainted(false);
    this.jcmdOK.setFocusable(false);
    this.jcmdOK.setMargin(new Insets(8, 16, 8, 16));
    this.jcmdOK.setRequestFocusEnabled(false);
    this.jcmdOK.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.jcmdOKActionPerformed(paramActionEvent);
      }
    });
    this.jPanel1.add(this.jcmdOK);
    this.jcmdCancel.setIcon(new ImageIcon(getClass().getResource("/com/openbravo/images/button_cancel.png")));
    this.jcmdCancel.setText(AppLocal.getIntString("Button.Cancel"));
    this.jcmdCancel.setFocusPainted(false);
    this.jcmdCancel.setFocusable(false);
    this.jcmdCancel.setMargin(new Insets(8, 16, 8, 16));
    this.jcmdCancel.setRequestFocusEnabled(false);
    this.jcmdCancel.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent paramActionEvent)
      {
        JTicketsFinder.this.jcmdCancelActionPerformed(paramActionEvent);
      }
    });
    this.jPanel1.add(this.jcmdCancel);
    this.jPanel8.add(this.jPanel1, "After");
    this.jPanel3.add(this.jPanel8, "South");
    getContentPane().add(this.jPanel3, "Center");
    this.jPanel2.setPreferredSize(new Dimension(200, 250));
    this.jPanel2.setLayout(new BorderLayout());
    this.jPanel2.add(this.m_jKeys, "North");
    getContentPane().add(this.jPanel2, "After");
    Dimension localDimension = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds((localDimension.width - 695) / 2, (localDimension.height - 684) / 2, 695, 684);
  }

  private void jcmdOKActionPerformed(ActionEvent paramActionEvent)
  {
    this.selectedTicket = ((FindTicketsInfo)this.jListTickets.getSelectedValue());
    dispose();
  }

  private void jcmdCancelActionPerformed(ActionEvent paramActionEvent)
  {
    dispose();
  }

  private void jButton3ActionPerformed(ActionEvent paramActionEvent)
  {
    executeSearch();
  }

  private void jListTicketsValueChanged(ListSelectionEvent paramListSelectionEvent)
  {
    this.jcmdOK.setEnabled(this.jListTickets.getSelectedValue() != null);
  }

  private void jListTicketsMouseClicked(MouseEvent paramMouseEvent)
  {
    if (paramMouseEvent.getClickCount() == 2)
    {
      this.selectedTicket = ((FindTicketsInfo)this.jListTickets.getSelectedValue());
      dispose();
    }
  }

  private void jButton1ActionPerformed(ActionEvent paramActionEvent)
  {
    defaultValues();
  }

  private void btnDateStartActionPerformed(ActionEvent paramActionEvent)
  {
    Date localDate;
	try
    {
      localDate = (Date)Formats.TIMESTAMP.parseValue(this.jTxtStartDate.getText());
    }
    catch (BasicException localBasicException)
    {
      localDate = null;
    }
      localDate = JCalendarDialog.showCalendarTimeHours(this, localDate);
    if (localDate != null)
      this.jTxtStartDate.setText(Formats.TIMESTAMP.formatValue(localDate));
  }

  private void btnDateEndActionPerformed(ActionEvent paramActionEvent)
  {
    Date localDate;
	try
    {
      localDate = (Date)Formats.TIMESTAMP.parseValue(this.jTxtEndDate.getText());
    }
    catch (BasicException localBasicException)
    {
      localDate = null;
    }
      localDate = JCalendarDialog.showCalendarTimeHours(this, localDate);
    if (localDate != null)
      this.jTxtEndDate.setText(Formats.TIMESTAMP.formatValue(localDate));
  }

  private void btnCustomerActionPerformed(ActionEvent paramActionEvent)
  {
    JCustomerFinder localJCustomerFinder = JCustomerFinder.getCustomerFinder(this, this.dlCustomers);
    localJCustomerFinder.search(null);
    localJCustomerFinder.setVisible(true);
    try
    {
      this.jtxtCustomer.setText(localJCustomerFinder.getSelectedCustomer() == null ? null : this.dlSales.loadCustomerExt(localJCustomerFinder.getSelectedCustomer().getId()).toString());
    }
    catch (BasicException localBasicException)
    {
      MessageInf localMessageInf = new MessageInf(-33554432, AppLocal.getIntString("message.cannotfindcustomer"), localBasicException);
      localMessageInf.show(this);
    }
  }

  private static class MyListData extends AbstractListModel
  {
    private List m_data;

    public MyListData(List paramList)
    {
      this.m_data = paramList;
    }

    public Object getElementAt(int paramInt)
    {
      return this.m_data.get(paramInt);
    }

    public int getSize()
    {
      return this.m_data.size();
    }
  }
}

/* Location:           D:\PowerFulPOS-2.30.2\openbravopos.jar
 * Qualified Name:     com.openbravo.pos.panels.JTicketsFinder
 * JD-Core Version:    0.6.0
 */